var t = require;
var e = module;
var o = exports;
var i = this && this.__awaiter ||
function(t, e, o, i) {
    return new(o || (o = Promise))(function(n, a) {
        function r(t) {
            try {
                l(i.next(t))
            } catch(e) {
                a(e)
            }
        }
        function s(t) {
            try {
                l(i.
                throw (t))
            } catch(e) {
                a(e)
            }
        }
        function l(t) {
            var e;
            t.done ? n(t.value) : (e = t.value, e instanceof o ? e: new o(function(t) {
                t(e)
            })).then(r, s)
        }
        l((i = i.apply(t, e || [])).next())
    })
},
n = this && this.__generator ||
function(t, e) {
    var o, i, n, a, r = {
        label: 0,
        sent: function() {
            if (1 & n[0]) throw n[1];
            return n[1]
        },
        trys: [],
        ops: []
    };
    return a = {
        next: s(0),
        throw: s(1),
        return: s(2)
    },
    "function" == typeof Symbol && (a[Symbol.iterator] = function() {
        return this
    }),
    a;
    function s(t) {
        return function(e) {
            return l([t, e])
        }
    }
    function l(a) {
        if (o) throw new TypeError("Generator is already executing.");
        for (; r;) try {
            if (o = 1, i && (n = 2 & a[0] ? i.
            return: a[0] ? i.
            throw || ((n = i.
            return) && n.call(i), 0) : i.next) && !(n = n.call(i, a[1])).done) return n;
            switch (i = 0, n && (a = [2 & a[0], n.value]), a[0]) {
                case 0:
                case 1:
                    n = a;
                break;
                case 4:
                    return r.label++,
                {
                    value: a[1],
                    done: !1
                };
                case 5:
                    r.label++,
                i = a[1],
                a = [0];
                continue;
                case 7:
                    a = r.ops.pop(),
                r.trys.pop();
                continue;
                default: if (! (n = (n = r.trys).length > 0 && n[n.length - 1]) && (6 === a[0] || 2 === a[0])) {
                    r = 0;
                    continue
                }
                if (3 === a[0] && (!n || a[1] > n[0] && a[1] < n[3])) {
                    r.label = a[1];
                    break
                }
                if (6 === a[0] && r.label < n[1]) {
                    r.label = n[1],
                    n = a;
                    break
                }
                if (n && r.label < n[2]) {
                    r.label = n[2],
                    r.ops.push(a);
                    break
                }
                n[2] && r.ops.pop(),
                r.trys.pop();
                continue;
            }
            a = e.call(t, r)
        } catch(s) {
            a = [6, s],
            i = 0
        } finally {
            o = n = 0
        }
        if (5 & a[0]) throw a[1];
        return {
            value: a[0] ? a[1] : void 0,
            done: !0
        }
    }
};
Object.defineProperty(o, "__esModule", {
    value: !0
});
var a = t("GlobalUserData"),
r = t("Hint"),
s = t("Global"),
l = t("SoundManager"),
c = t("Util"),
d = t("AdUnitManager"),
h = function() {
    function t() {
        this.bannerAdID = "191092",
        this.insertAdID = "191093",
        this.nativeAdID = "191097",
        this.bannerAd = null,
        this.rewardVideoAd = null,
        this.insertAd = null,
        this.gridAd = null,
        this.matrixAd = null,
        this.bannerTopCustom = 1,
        this.isIPhone5 = !1,
        this.gameVersion = "1.0.7",
        this.shareTitle = "",
        this.video_shareApp_enabled = !0,
        this.is_wx_onShow = !0,
        this.time_onHide = 0,
        this.deltaTime_change_state = 0,
        this.bannerAds = [],
        this.bannerId = 0,
        this.bannersId = ["adunit-d1406e0268b377fa", "adunit-29a9ec439677306a", "adunit-a2e23cf7f736a51e"],
        this.rewardVideoAds = [],
        this.rewardVideoId = 0,
        this.videosId = ["adunit-f5f5c83399515bfe", "adunit-9d7b7cc1ac383687", "adunit-5a454e4c2343e9b2"],
        this.singleCustomAdIDArray = ["adunit-39754799b7597316", "adunit-7b72121e4966b84c", "adunit-60d85322c98bb735", "adunit-da36d7efed3b739d", "adunit-4f8e3d28a5019c32"],
        this.is_click_btn_share = !1,
        this.share_func = null,
        this.refreshId = 0,
        this.majia_banner = null,
        this.majia_banner_isShow = !1,
        this.showPos = 0,
        this.canShow = !0,
        this.isHideRefreshBanner = !1,
        this.mistakeTouchBanner = {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        this.mistakeBanner = {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        this.hallBanner = {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        this.click_video = !1,
        this.current_share_video_times = 0,
        this.refreshCustomAdTime = 3e3,
        this.hallSingleCustomAd = {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        this.hallSingleCustomAdRefreshTimer = null,
        this.curHallCustomAd = null,
        this.singleCustomAdRefreshIndex = 0,
        this.leftSingleCustomAd = {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        this.leftSingleCustomAdRefreshTimer = null,
        this.curLeftCustomAd = null,
        this.rightSingleCustomAd = {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        this.rightSingleCustomAdRefreshTimer = null,
        this.curRightCustomAd = null,
        this.gameSingleCustomAd = {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        this.gameSingleCustomAdRefreshTimer = null,
        this.curGameCustomAd = null,
        this.endUISingleCustomAd = {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        this.endUISingleCustomAdRefreshTimer = null,
        this.curEndUICustomAd = null,
        this.singleCustomAdLeftArr = [{
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        }],
        this.singleCustomAdRightArr = [{
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        }],
        this.leftSingleCustomAdIdIndex = 0,
        this.rightSingleCustomAdIdIndex = 4,
        this.leftHallCustomAdTimer = null,
        this.rightHallCustomAdTimer = null,
        this.singleGameCustomAdLeftArr = [{
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        }],
        this.singleGameCustomAdRightArr = [{
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        }],
        this.leftSingleGameCustomAdIdIndex = 0,
        this.rightSingleGameCustomAdIdIndex = 4,
        this.leftGameCustomAdTimer = null,
        this.rightGameCustomAdTimer = null,
        this.customAdR = {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        this.customAdRGame = {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        this.customAdL = {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        this.customAdLGame = {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        this.horizontalCustomAd = {
            ad: null,
            isLoad: !1,
            is_show: !1,
            is_showing: !1
        },
        this.customAdArray = [{
            ad: null,
            isLoad: !1,
            is_show: !1,
            is_showing: !1
        },
        {
            ad: null,
            isLoad: !1,
            is_show: !1,
            is_showing: !1
        },
        {
            ad: null,
            isLoad: !1,
            is_show: !1,
            is_showing: !1
        }],
        this.customAdIDArray = ["adunit-60d85322c98bb735", "adunit-da36d7efed3b739d", "adunit-4f8e3d28a5019c32"],
        this.matrixCustomAd = {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        },
        this.majiaCustomAd = {
            ad: null,
            isLoad: !1,
            isShow: !1,
            isHide: !1
        }
    }
    return t.getIntance = function() {
        return null == this._instance && (this._instance = new t),
        this._instance
    },
    t.prototype.initConfig = function() {
        return i(this, void 0, void 0,
        function() {
            var t, e, o = this;
            return n(this,
            function() {
                return this.updateManager(),
                wx.onHide(function() {
                    console.log("切入后台"),
                    cc.audioEngine.pauseAll(),
                    l.default.GetInstance().stopMusic(),
                    setTimeout(function() {
                        cc.game.pause()
                    },
                    500),
                    clearTimeout(o.leftGameCustomAdTimer),
                    clearTimeout(o.leftHallCustomAdTimer),
                    clearTimeout(o.rightGameCustomAdTimer),
                    clearTimeout(o.rightHallCustomAdTimer),
                    clearTimeout(o.hallSingleCustomAdRefreshTimer),
                    clearTimeout(o.leftSingleCustomAdRefreshTimer),
                    clearTimeout(o.rightSingleCustomAdRefreshTimer),
                    clearTimeout(o.gameSingleCustomAdRefreshTimer),
                    clearTimeout(o.endUISingleCustomAdRefreshTimer)
                }),
                wx.onShow(function() {
                    console.log("切回前台"),
                    setTimeout(function() {
                        cc.game.resume()
                    },
                    500),
                    cc.audioEngine.resumeAll(),
                    l.default.GetInstance().play_current_bgm(),
                    c.Util.event_dispatcher.sendMessage("onWxShow")
                }),
                wx.showShareMenu({
                    withShareTicket: !0,
                    menus: ["shareAppMessage", "shareTimeline"]
                }),
                wx.onShareAppMessage(function() {
                    return {
                        title: "好友@你，单挑，敢就来！",
                        imageUrlId: "qbwqe+JrSQmBRI4xipRSQg==",
                        imageUrl: "https://mmocgame.qpic.cn/wechatgame/icibO3fTSYqyS07J2SWUTsksAoFmXawbvXib0NxOo3HldnVbKsYT7Cp8AnSgMCypNRv/0"
                    }
                }),
                t = wx.getLaunchOptionsSync(),
                c.Util.loadSceneId(t.scene),
                this.systemInfo = wx.getSystemInfoSync(),
                cc.log(this.systemInfo),
                "iPhone 5" == this.systemInfo.model || "iPhone SE" == this.systemInfo.model ? (this.bannerTopCustom = 1.15, this.isIPhone5 = !0) : this.isIPhone5 = !1,
                void 0 === (e = wx.getExptInfoSync(["expt_1634282288"])).expt_1634282288 ? a.default.exptInfo = s.ExptInfo.unknown: "0" == e.expt_1634282288 ? a.default.exptInfo = s.ExptInfo.contrast: "1" == e.expt_1634282288 ? a.default.exptInfo = s.ExptInfo.experiment0: a.default.exptInfo = s.ExptInfo.unknown,
                this.init_json(),
                [2]
            })
        })
    },
    t.prototype.initAdUnit = function() {
        this.bannersId = d.default.getIntance().WXAdUnit.bannerIds,
        this.videosId = d.default.getIntance().WXAdUnit.videoIds,
        this.nativeMultiGrid01Ad = d.default.getIntance().WXAdUnit.nativeMultiGrid01Ad,
        this.nativeMultiGrid02Ad = d.default.getIntance().WXAdUnit.nativeMultiGrid02Ad,
        this.singleCustomAdIDArray = d.default.getIntance().WXAdUnit.nativeSingleGridAds
    },
    t.prototype.expt_GetDiamond = function(t) {
        c.Util.is_wx() && wx.reportEvent("expt_GetDiamond", {
            expt_data: t
        })
    },
    t.prototype.expt_GetGold = function(t) {
        c.Util.is_wx() && wx.reportEvent("expt_GetGold", {
            expt_data: t
        })
    },
    t.prototype.updateManager = function() {
        var t = wx.getUpdateManager();
        t.onCheckForUpdate(function(t) {
            cc.log(t.hasUpdate)
        }),
        t.onUpdateReady(function() {
            cc.log("更新提示 -- 000"),
            wx.showModal({
                title: "更新提示",
                content: "新版本已经准备好，是否重启应用？",
                success: function(e) {
                    e.confirm && (cc.log("更新提示 -- 000 --111"), t.applyUpdate())
                }
            })
        }),
        t.onUpdateFailed(function() {
            cc.log("更新提示 -- 1111"),
            wx.showModal({
                title: "更新提示",
                content: "更新失败,请删除小游戏重试"
            })
        })
    },
    t.prototype.init_json = function() {
        return i(this, void 0, void 0,
        function() {
            return n(this,
            function() {
                return [2]
            })
        })
    },
    t.prototype.is_review_version = function() {
        return this.gameVersion == this.config_version
    },
    t.prototype.shareAppMsg = function(t, e) {
        var o = this;
        if (c.Util.is_wx()) {
            wx.shareAppMessage({
                title: t.title,
                imageUrlId: t.imageUrlId,
                imageUrl: t.imageUrl
            }),
            this.click_video = !1,
            this.is_click_btn_share = !0,
            this.time_onHide = new Date().getTime();
            var i = !0;
            wx.onShow(function() {
                i && (i = !1, o.deltaTime_change_state = new Date().getTime() - o.time_onHide, cc.log("time: " + o.deltaTime_change_state), o.deltaTime_change_state >= 3e3 && e && e(), e = null)
            })
        }
    },
    t.prototype.send_event = function() {},
    t.prototype.aladin_start = function(t) {
        cc.log("aladin_start -- levelId = ", t),
        wx.aldStage.onStart({
            stageId: t,
            stageName: "关卡 " + t
        })
    },
    t.prototype.aladin_onRunning = function(t, e) {
        wx.aldStage.onRunning({
            stageId: t,
            stageName: "关卡 " + t,
            event: "tools",
            params: {
                itemName: e
            }
        })
    },
    t.prototype.aladin_win = function(t) {
        cc.log("aladin_win -- levelId = ", t),
        wx.aldStage.onEnd({
            stageId: t,
            stageName: "关卡 " + t,
            event: "complete",
            params: {
                desc: "关卡完成"
            }
        })
    },
    t.prototype.aladin_fail = function(t) {
        cc.log("aladin_fail -- levelId = ", t),
        wx.aldStage.onEnd({
            stageId: t,
            stageName: "关卡 " + t,
            event: "fail",
            params: {
                desc: "关卡失败"
            }
        })
    },
    t.prototype.isFitVersion = function(t) {
        return ! (c.Util.compareVersion(this.systemInfo.SDKVersion, t) < 0 && (wx.showModal({
            title: "提示",
            content: "当前微信版本过低，无法使用该功能，请升级到最新微信版本后重试。"
        }), 1))
    },
    t.prototype.init_banner = function() {
        var t = this;
        if (! (0 == this.isFitVersion("2.0.4") || this.bannerAds.length > 0)) {
            for (var e = function(e) {
                var i = o.bannersId[e],
                n = function() {
                    cc.log("banner加载完成"),
                    r.offLoad(n)
                },
                a = function() {
                    r.offError(a)
                },
                r = wx.createBannerAd({
                    adUnitId: i,
                    adIntervals: 30,
                    style: {
                        left: 0,
                        top: 0,
                        width: 300
                    }
                });
                r.onResize(function(e) {
                    r.style.left = t.systemInfo.windowWidth / 2 - e.width / 2,
                    r.style.top = t.systemInfo.windowHeight - e.height / t.bannerTopCustom
                }),
                r.offError(a),
                r && r.onError(a),
                r.onLoad(n),
                o.bannerAds.push(r)
            },
            o = this, i = 0; i < this.bannersId.length; i++) e(i);
            cc.log("banner初始化完成")
        }
    },
    t.prototype.refreshBanner = function(t) {
        return void 0 === t && (t = !0),
        i(this, void 0, void 0,
        function() {
            var t, e, o, i = this;
            return n(this,
            function(n) {
                switch (n.label) {
                    case 0:
                        return 0 == this.isFitVersion("2.0.4") ? [2] : (this.isHideRefreshBanner = !1, t = this.bannersId[this.refreshId], e = wx.createBannerAd({
                        adUnitId: t,
                        adIntervals: 30,
                        style: {
                            left: 0,
                            top: 0,
                            width: 300
                        }
                    }), o = function(t) {
                        e.style.left = i.systemInfo.windowWidth / 2 - t.width / 2,
                        e.style.top = i.systemInfo.windowHeight - t.height / i.bannerTopCustom
                    },
                    e.onResize(o), [4, new Promise(function(t) {
                        var o = function() {
                            console.log("banner" + i.refreshId + " 刷新成功"),
                            e.offLoad(o),
                            i.bannerAds[i.refreshId] = e,
                            i.refreshId,
                            i.refreshId++,
                            i.refreshId >= i.bannerAds.length && (i.refreshId = 0),
                            t("success")
                        };
                        e.onLoad(o)
                    })]);
                    case 1:
                        return n.sent(),
                    [2];
                }
            })
        })
    },
    t.prototype.refresh_majia_banner = function() {
        var t = this;
        if (!a.default.isTest) {
            this.majia_banner && (this.majia_banner.hide(), this.majia_banner.destroy(), this.majia_banner = null);
            var e = this.bannersId[0];
            this.majia_banner = wx.createBannerAd({
                adUnitId: e,
                adIntervals: 30,
                style: {
                    left: this.systemInfo.windowWidth / 2 - 150,
                    top: this.systemInfo.windowHeight,
                    width: 300
                }
            }),
            this.majia_banner.onResize(function(e) {
                t.majia_banner_size = e
            }),
            this.majia_banner.onLoad(function() {
                t.showPos = t.systemInfo.windowHeight - t.majia_banner_size.height,
                t.majia_banner.offLoad(),
                t.majia_banner.show()
            });
            var o = function() {
                t.majia_banner.offError(o)
            };
            this.majia_banner.onError(o)
        }
    },
    t.prototype.show_majia_banner = function(t) {
        a.default.isTest || this.majia_banner && (this.majia_banner_isShow = !0, this.majia_banner.style.top = this.showPos, setTimeout(function() {
            t && t()
        },
        1e3))
    },
    t.prototype.hide_majia_banner = function() {
        a.default.isTest || this.majia_banner_isShow && this.majia_banner && (this.majia_banner_isShow = !1, this.majia_banner.style.top = this.systemInfo.windowHeight, this.refresh_majia_banner())
    },
    t.prototype.show_banner = function(t, e) {
        void 0 === t && (t = !1),
        void 0 === e && (e = !1),
        0 != this.isFitVersion("2.0.4") && (this.hide_banner(), this.bannerAd = this.bannerAds[this.bannerId], this.bannerId++, this.bannerId >= this.bannerAds.length && (this.bannerId = 0), e && a.default.bannerOnRight ? this.bannerAd.style.left = this.systemInfo.windowWidth - 300 : this.bannerAd.style.left = this.systemInfo.windowWidth / 2 - 150, this.bannerAd.show())
    },
    t.prototype.hide_banner = function() {
        this.isHideRefreshBanner = !0,
        this.bannerAd && this.bannerAd.hide()
    },
    t.prototype.showMistakeTouchBanner = function(t, e) {
        var o = this;
        void 0 === e && (e = !1),
        console.log("误触bannerTouchSW：展示"),
        this.mistakeTouchBanner.isHide = !1;
        var i = this.bannersId[Math.floor(Math.random() * this.bannersId.length)];
        this.mistakeTouchBanner.ad = wx.createBannerAd({
            adUnitId: i,
            adIntervals: 30,
            style: {
                left: 0,
                top: 0,
                width: 300
            }
        }),
        this.mistakeTouchBanner.ad.onResize(function(t) {
            o.mistakeTouchBanner.ad.style.left = e ? o.systemInfo.windowWidth / 2 - t.width / 2 - t.width / 1.5 : o.systemInfo.windowWidth / 2 - t.width / 2,
            o.mistakeTouchBanner.ad.style.top = e ? o.systemInfo.windowHeight - t.height - t.height / 2 : o.systemInfo.windowHeight - t.height
        }),
        this.mistakeTouchBanner.ad.onLoad(function() {
            o.mistakeTouchBanner.isLoad = !0,
            o.mistakeTouchBanner.ad.offLoad(),
            o.mistakeTouchBanner.isHide || o.mistakeTouchBanner.ad.show().then(function() {
                o.mistakeTouchBanner.isShow = !0,
                t.success && t.success.call(t.caller)
            })
        });
        var n = function() {
            t.error && t.error.call(t.caller),
            o.mistakeTouchBanner.ad.offError(n)
        };
        this.mistakeTouchBanner.ad.onError(n)
    },
    t.prototype.hideMistakeTouchBanner = function() {
        var t = this;
        this.mistakeTouchBanner.isHide = !0,
        this.mistakeTouchBanner.isShow && this.mistakeTouchBanner.ad.hide().then(function() {
            t.mistakeTouchBanner.isShow = !1
        })
    },
    t.prototype.showMistakeBanner = function(t, e, o) {
        var i = this;
        if (0 != a.default.isShowMistakeBanner && 0 != c.Util.canShowMistakeBanner()) {
            this.mistakeBanner.isHide = !1;
            var n = this.bannersId[Math.floor(Math.random() * this.bannersId.length)];
            if (!this.mistakeBanner.ad || o) {
                this.mistakeBanner.ad = wx.createBannerAd({
                    adUnitId: n,
                    adIntervals: 30,
                    style: {
                        left: 0,
                        top: 0,
                        width: 300
                    }
                }),
                this.mistakeBanner.ad.onResize(function(t) {
                    i.mistakeBanner.ad.style.left = i.systemInfo.windowWidth / 2 - t.width / 2,
                    i.mistakeBanner.ad.style.top = i.systemInfo.windowHeight - t.height - t.height / 2
                }),
                this.mistakeBanner.ad.onLoad(function() {
                    i.mistakeBanner.isLoad = !0,
                    cc.log("误触banner加载成功"),
                    i.mistakeBanner.ad.offLoad(),
                    i.mistakeBanner.isHide || i.mistakeBanner.ad.show().then(function() {
                        i.mistakeBanner.isShow = !0,
                        t && t()
                    })
                });
                var r = function() {
                    e && e(),
                    i.mistakeBanner.ad.offError(r)
                };
                this.mistakeBanner.ad.onError(r)
            } else this.mistakeBanner.isHide || this.mistakeBanner.ad.show().then(function() {
                i.mistakeBanner.isShow = !0,
                t && t()
            })
        }
    },
    t.prototype.hideMistakeBanner = function() {
        var t = this;
        0 != a.default.isShowMistakeBanner && (this.mistakeBanner.isHide = !0, this.mistakeBanner.isShow && this.mistakeBanner.ad.hide().then(function() {
            t.mistakeBanner.isShow = !1
        }))
    },
    t.prototype.showHallBanner = function() {
        var t = this;
        this.hallBanner.isHide = !1;
        var e = this.bannersId[this.bannerId];
        this.hallBanner.ad ? this.hallBanner.isLoad && this.hallBanner.ad.show().then(function() {
            t.hallBanner.isShow = !0
        }) : (this.hallBanner.ad = wx.createBannerAd({
            adUnitId: e,
            adIntervals: 30,
            style: {
                left: 0,
                top: 0,
                width: 300
            }
        }), this.hallBanner.ad.onResize(function(e) {
            t.hallBanner.ad.style.left = t.systemInfo.windowWidth / 2 - e.width / 2 - e.width / 2,
            t.hallBanner.ad.style.top = t.systemInfo.windowHeight - e.height
        }), this.hallBanner.ad.onLoad(function() {
            t.hallBanner.isLoad = !0,
            t.hallBanner.ad.offLoad(),
            t.hallBanner.isHide || t.hallBanner.ad.show().then(function() {
                t.hallBanner.isShow = !0
            })
        }))
    },
    t.prototype.hideHallBanner = function() {
        var t = this;
        this.hallBanner.isHide = !0,
        this.hallBanner.isShow && this.hallBanner.ad.hide().then(function() {
            t.hallBanner.isShow = !1
        })
    },
    t.prototype.init_rewardVideo = function() {
        this.rewardVideoAd || (this.rewardVideoAd = wx.createRewardedVideoAd({
            adUnitId: this.videosId[0]
        }), this.rewardVideoAd.onError(function(t) {
            cc.log("onError --- : "),
            cc.log(t)
        }))
    },
    t.prototype.show_rewardVideo = function(t, e, o, i) {
        var n = this;
        if (!this.click_video && (this.click_video = !0, console.log("视频播放"), 0 != this.isFitVersion("2.0.4"))) {
            var s = this;
            this.rewardVideoAd.show({
                branchId: "BCBgAAoXHx5d0l0VVJKBm7",
                branchDim: ""
            }).
            catch(function() {
                s.rewardVideoAd.load().then(function() {
                    return s.rewardVideoAd.show({
                        branchId: "BCBgAAoXHx5d0l0VVJKBm7",
                        branchDim: ""
                    })
                }).
                catch(function(e) {
                    o && o(),
                    i ? n.shareAppMsg(a.default.shareInfo, t) : (r.default.show("视频加载失败"), n.click_video = !1, console.log(e), console.log("激励视频 广告显示失败"))
                })
            });
            var c = function(o) {
                a.default.isVideoLoaded = !1,
                s.rewardVideoAd.offClose(c),
                n.click_video = !1,
                o.isEnded ? t && t() : e && e(),
                s.rewardVideoAd.offClose(c),
                cc.audioEngine.resumeAll(),
                l.default.GetInstance().play_current_bgm()
            };
            s.rewardVideoAd.offClose(c),
            s.rewardVideoAd.onClose(c)
        }
    },
    t.prototype.show_insertAd = function(t, e, o) {
        var i = this;
        if (0 != this.isFitVersion("2.6.0")) {
            this.insertAd && this.insertAd.destroy(),
            this.insertAd = wx.createInterstitialAd({
                adUnitId: d.default.getIntance().WXAdUnit.interstitialAd
            });
            var n = function() {
                i.insertAd.show().then(function() {
                    t && t()
                }).
                catch(function(t) {
                    cc.error(t),
                    o && o()
                }),
                i.insertAd.offLoad(n)
            };
            this.insertAd.offLoad(n),
            this.insertAd.onLoad(n);
            var a = function() {
                e && e(),
                i.insertAd.offClose(a)
            };
            this.insertAd.offClose(a),
            this.insertAd.onClose(a)
        }
    },
    t.prototype.showSingleCustomAd = function(t, e) {
        0 != this.isFitVersion("2.11.2") && (this.leftSingleCustomAdIdIndex = 0, this.rightSingleCustomAdIdIndex = this.singleCustomAdIDArray.length - 1, "game" == e ? this.showGameSingleCustomAd() : this.showHallSingleCustomAd(t))
    },
    t.prototype.hideSingleCustomAd = function() {
        0 != this.isFitVersion("2.11.2") && (clearTimeout(this.hallSingleCustomAdRefreshTimer), clearTimeout(this.gameSingleCustomAdRefreshTimer), clearTimeout(this.leftSingleCustomAdRefreshTimer), clearTimeout(this.rightSingleCustomAdRefreshTimer), clearTimeout(this.endUISingleCustomAdRefreshTimer), this.hideHallSingleCustomAd(), this.hideEndUISingleCustomAd(), this.hideGameSingleCustomAd(), this.hideLeftSingleCustomAd(), this.hideRightSingleCustomAd())
    },
    t.prototype.showHallSingleCustomAd = function(t) {
        var e = this;
        if (this.curHallCustomAd = null, this.singleCustomAdRefreshIndex++, this.singleCustomAdRefreshIndex >= this.singleCustomAdIDArray.length && (this.singleCustomAdRefreshIndex = 0), clearTimeout(this.hallSingleCustomAdRefreshTimer), this.hallSingleCustomAd.isHide = !1, this.curHallCustomAd) this.hallSingleCustomAd.isLoad && this.hallSingleCustomAd.ad.show().then(function() {
            e.hallSingleCustomAd.isShow = !0
        });
        else {
            var o = 40,
            i = this.systemInfo.windowHeight / 2 - 30;
            t && (o = this.systemInfo.windowWidth / 2 + t.x, i = this.systemInfo.windowHeight / 2 + t.y),
            this.curHallCustomAd = wx.createCustomAd({
                adUnitId: this.singleCustomAdIDArray[this.singleCustomAdRefreshIndex],
                left: o,
                top: i,
                fixed: !1
            }),
            this.curHallCustomAd.onLoad(function() {
                e.hallSingleCustomAd.isLoad = !0,
                e.hallSingleCustomAd.isHide ? e.hallSingleCustomAd.ad = e.curHallCustomAd: e.curHallCustomAd.show().then(function() {
                    e.hallSingleCustomAd.ad && e.hallSingleCustomAd.ad.destroy(),
                    e.hallSingleCustomAd.ad = e.curHallCustomAd,
                    e.hallSingleCustomAd.isShow = !0
                })
            })
        }
    },
    t.prototype.refreshHallSingleCustomAd = function(t) {
        var e = this;
        this.hallSingleCustomAdRefreshTimer = setTimeout(function() {
            e.curHallCustomAd = null,
            e.singleCustomAdRefreshIndex++,
            e.singleCustomAdRefreshIndex >= e.singleCustomAdIDArray.length && (e.singleCustomAdRefreshIndex = 0),
            e.showHallSingleCustomAd(t)
        },
        this.refreshCustomAdTime)
    },
    t.prototype.hideHallSingleCustomAd = function() {
        var t = this;
        clearTimeout(this.hallSingleCustomAdRefreshTimer),
        this.hallSingleCustomAd.isHide = !0,
        this.hallSingleCustomAd.isShow && this.hallSingleCustomAd.ad.hide().then(function() {
            t.hallSingleCustomAd.isShow = !1
        })
    },
    t.prototype.showLeftSingleCustomAd = function() {
        var t = this;
        if (clearTimeout(this.leftSingleCustomAdRefreshTimer), this.leftSingleCustomAd.isHide = !1, this.curLeftCustomAd) this.leftSingleCustomAd.isLoad && this.leftSingleCustomAd.ad.show().then(function() {
            t.leftSingleCustomAd.isShow = !0,
            t.refreshLeftSingleCustomAd()
        });
        else {
            var e = this.systemInfo.windowHeight / 2 - 70;
            this.curLeftCustomAd = wx.createCustomAd({
                adUnitId: this.singleCustomAdIDArray[this.singleCustomAdRefreshIndex],
                left: 35,
                top: e,
                fixed: !1
            }),
            this.curLeftCustomAd.onLoad(function() {
                t.leftSingleCustomAd.isLoad = !0,
                t.leftSingleCustomAd.isHide ? t.leftSingleCustomAd.ad = t.curLeftCustomAd: t.curLeftCustomAd.show().then(function() {
                    t.leftSingleCustomAd.ad && t.leftSingleCustomAd.ad.destroy(),
                    t.leftSingleCustomAd.ad = t.curLeftCustomAd,
                    t.leftSingleCustomAd.isShow = !0,
                    t.refreshLeftSingleCustomAd()
                })
            })
        }
    },
    t.prototype.refreshLeftSingleCustomAd = function() {
        var t = this;
        this.leftSingleCustomAdRefreshTimer = setTimeout(function() {
            t.curLeftCustomAd = null,
            t.singleCustomAdRefreshIndex++,
            t.singleCustomAdRefreshIndex >= t.singleCustomAdIDArray.length && (t.singleCustomAdRefreshIndex = 0),
            t.showLeftSingleCustomAd()
        },
        this.refreshCustomAdTime)
    },
    t.prototype.hideLeftSingleCustomAd = function() {
        var t = this;
        clearTimeout(this.leftSingleCustomAdRefreshTimer),
        this.leftSingleCustomAd.isHide = !0,
        this.leftSingleCustomAd.isShow && this.leftSingleCustomAd.ad.hide().then(function() {
            t.leftSingleCustomAd.isShow = !1
        })
    },
    t.prototype.showRightSingleCustomAd = function() {
        var t = this;
        if (clearTimeout(this.rightSingleCustomAdRefreshTimer), this.rightSingleCustomAd.isHide = !1, this.curRightCustomAd) this.rightSingleCustomAd.isLoad && this.rightSingleCustomAd.ad.show().then(function() {
            t.rightSingleCustomAd.isShow = !0,
            t.refreshRightSingleCustomAd()
        });
        else {
            var e = this.systemInfo.windowWidth - 100,
            o = this.systemInfo.windowHeight / 2 - 70;
            this.curRightCustomAd = wx.createCustomAd({
                adUnitId: this.singleCustomAdIDArray[this.singleCustomAdRefreshIndex],
                left: e,
                top: o,
                fixed: !1
            }),
            this.curRightCustomAd.onLoad(function() {
                t.rightSingleCustomAd.isLoad = !0,
                t.rightSingleCustomAd.isHide ? t.rightSingleCustomAd.ad = t.curRightCustomAd: t.curRightCustomAd.show().then(function() {
                    t.rightSingleCustomAd.ad && t.rightSingleCustomAd.ad.destroy(),
                    t.rightSingleCustomAd.ad = t.curRightCustomAd,
                    t.rightSingleCustomAd.isShow = !0,
                    t.refreshRightSingleCustomAd()
                })
            })
        }
    },
    t.prototype.refreshRightSingleCustomAd = function() {
        var t = this;
        this.rightSingleCustomAdRefreshTimer = setTimeout(function() {
            t.curRightCustomAd = null,
            t.singleCustomAdRefreshIndex++,
            t.singleCustomAdRefreshIndex >= t.singleCustomAdIDArray.length && (t.singleCustomAdRefreshIndex = 0),
            t.showRightSingleCustomAd()
        },
        this.refreshCustomAdTime)
    },
    t.prototype.hideRightSingleCustomAd = function() {
        var t = this;
        clearTimeout(this.rightSingleCustomAdRefreshTimer),
        this.rightSingleCustomAd.isHide = !0,
        this.rightSingleCustomAd.isShow && this.rightSingleCustomAd.ad.hide().then(function() {
            t.rightSingleCustomAd.isShow = !1
        })
    },
    t.prototype.showGameSingleCustomAd = function() {
        var t = this;
        if (console.log("游戏单格子"), this.curGameCustomAd = null, this.singleCustomAdRefreshIndex++, this.singleCustomAdRefreshIndex >= this.singleCustomAdIDArray.length && (this.singleCustomAdRefreshIndex = 0), clearTimeout(this.gameSingleCustomAdRefreshTimer), this.gameSingleCustomAd.isHide = !1, this.curGameCustomAd) this.gameSingleCustomAd.isLoad && this.gameSingleCustomAd.ad.show().then(function() {
            t.gameSingleCustomAd.isShow = !0
        });
        else {
            var e = this.systemInfo.windowWidth / 2 + 150,
            o = this.systemInfo.windowHeight / 2 + 80;
            this.curGameCustomAd = wx.createCustomAd({
                adUnitId: this.singleCustomAdIDArray[this.singleCustomAdRefreshIndex],
                left: e,
                top: o,
                fixed: !1
            }),
            this.curGameCustomAd.onLoad(function() {
                t.gameSingleCustomAd.isLoad = !0,
                t.gameSingleCustomAd.isHide ? t.gameSingleCustomAd.ad = t.curGameCustomAd: t.curGameCustomAd.show().then(function() {
                    t.gameSingleCustomAd.ad && t.gameSingleCustomAd.ad.destroy(),
                    t.gameSingleCustomAd.ad = t.curGameCustomAd,
                    t.gameSingleCustomAd.isShow = !0
                })
            })
        }
    },
    t.prototype.refreshGameSingleCustomAd = function() {
        var t = this;
        this.gameSingleCustomAdRefreshTimer = setTimeout(function() {
            t.curGameCustomAd = null,
            t.singleCustomAdRefreshIndex++,
            t.singleCustomAdRefreshIndex >= t.singleCustomAdIDArray.length && (t.singleCustomAdRefreshIndex = 0),
            t.showGameSingleCustomAd()
        },
        this.refreshCustomAdTime)
    },
    t.prototype.hideGameSingleCustomAd = function() {
        var t = this;
        clearTimeout(this.gameSingleCustomAdRefreshTimer),
        this.gameSingleCustomAd.isHide = !0,
        this.gameSingleCustomAd.isShow && this.gameSingleCustomAd.ad.hide().then(function() {
            t.gameSingleCustomAd.isShow = !1
        })
    },
    t.prototype.showEndUISingleCustomAd = function() {
        var t = this;
        if (clearTimeout(this.endUISingleCustomAdRefreshTimer), this.endUISingleCustomAd.isHide = !1, this.curEndUICustomAd) this.endUISingleCustomAd.isLoad && this.endUISingleCustomAd.ad.show().then(function() {
            t.endUISingleCustomAd.isShow = !0,
            t.refreshEndUISingleCustomAd()
        });
        else {
            var e = this.systemInfo.windowWidth - 106 * this.systemInfo.pixelRatio / 2,
            o = this.systemInfo.windowHeight / 2;
            this.curEndUICustomAd = wx.createCustomAd({
                adUnitId: this.singleCustomAdIDArray[this.singleCustomAdRefreshIndex],
                left: e,
                top: o,
                fixed: !1
            }),
            this.curEndUICustomAd.onLoad(function() {
                t.endUISingleCustomAd.isLoad = !0,
                t.endUISingleCustomAd.isHide ? t.endUISingleCustomAd.ad = t.curEndUICustomAd: t.curEndUICustomAd.show().then(function() {
                    t.endUISingleCustomAd.ad && t.endUISingleCustomAd.ad.destroy(),
                    t.endUISingleCustomAd.ad = t.curEndUICustomAd,
                    t.endUISingleCustomAd.isShow = !0,
                    t.refreshEndUISingleCustomAd()
                })
            })
        }
    },
    t.prototype.refreshEndUISingleCustomAd = function() {
        var t = this;
        this.endUISingleCustomAdRefreshTimer = setTimeout(function() {
            t.curEndUICustomAd = null,
            t.singleCustomAdRefreshIndex++,
            t.singleCustomAdRefreshIndex >= t.singleCustomAdIDArray.length && (t.singleCustomAdRefreshIndex = 0),
            t.showEndUISingleCustomAd()
        },
        this.refreshCustomAdTime)
    },
    t.prototype.hideEndUISingleCustomAd = function() {
        var t = this;
        clearTimeout(this.endUISingleCustomAdRefreshTimer),
        this.endUISingleCustomAd.isHide = !0,
        this.endUISingleCustomAd.isShow && this.endUISingleCustomAd.ad.hide().then(function() {
            t.endUISingleCustomAd.isShow = !1
        })
    },
    t.prototype.showLeftHallCustomAd = function(t) {
        var e = this;
        clearTimeout(this.leftHallCustomAdTimer);
        var o = this.singleCustomAdLeftArr[this.leftSingleCustomAdIdIndex];
        if (o.isHide = !1, o.ad) o.isLoad && o.ad.show().then(function() {
            o.isShow = !0,
            t && t(),
            e.preLoadNextLeftAd()
        });
        else {
            var i = this.systemInfo.windowHeight / 2 - 70;
            o.ad = wx.createCustomAd({
                adUnitId: this.singleCustomAdIDArray[this.leftSingleCustomAdIdIndex],
                left: 50,
                top: i,
                fixed: !1
            }),
            o.ad.onLoad(function() {
                o.isLoad = !0,
                !o.isHide && o.ad.show().then(function() {
                    o.isShow = !0,
                    t && t(),
                    e.preLoadNextLeftAd()
                })
            })
        }
    },
    t.prototype.preLoadNextLeftAd = function() {
        var t = this,
        e = this.singleCustomAdLeftArr[this.leftSingleCustomAdIdIndex];
        this.leftSingleCustomAdIdIndex++,
        this.leftSingleCustomAdIdIndex > this.singleCustomAdIDArray.length - 1 && (this.leftSingleCustomAdIdIndex = 0);
        var o = this.singleCustomAdLeftArr[this.leftSingleCustomAdIdIndex];
        if (o.ad) this.leftHallCustomAdTimer = setTimeout(function() {
            0 == e.isHide && e.isShow && e.ad.hide().then(function() {
                e.isHide = !0,
                e.isShow = !1,
                t.showLeftHallCustomAd()
            })
        },
        this.refreshCustomAdTime);
        else {
            var i = this.systemInfo.windowHeight / 2 - 70;
            o.ad = wx.createCustomAd({
                adUnitId: this.singleCustomAdIDArray[this.leftSingleCustomAdIdIndex],
                left: 50,
                top: i,
                fixed: !1
            }),
            o.ad.onLoad(function() {
                o.isLoad = !0,
                t.leftHallCustomAdTimer = setTimeout(function() {
                    0 == e.isHide && e.isShow && e.ad.hide().then(function() {
                        e.isHide = !0,
                        e.isShow = !1,
                        t.showLeftHallCustomAd()
                    })
                },
                t.refreshCustomAdTime)
            })
        }
    },
    t.prototype.showRightHallCustomAd = function(t) {
        var e = this;
        clearTimeout(this.rightHallCustomAdTimer);
        var o = this.singleCustomAdRightArr[this.rightSingleCustomAdIdIndex];
        if (o.isHide = !1, o.ad) o.isLoad && o.ad.show().then(function() {
            o.isShow = !0,
            t && t(),
            e.preLoadNextRightAd()
        });
        else {
            var i = this.systemInfo.windowWidth - 120,
            n = this.systemInfo.windowHeight / 2 - 70;
            o.ad = wx.createCustomAd({
                adUnitId: this.singleCustomAdIDArray[this.rightSingleCustomAdIdIndex],
                left: i,
                top: n,
                fixed: !1
            }),
            o.ad.onLoad(function() {
                o.isLoad = !0,
                !o.isHide && o.ad.show().then(function() {
                    o.isShow = !0,
                    t && t(),
                    e.preLoadNextRightAd()
                })
            })
        }
    },
    t.prototype.preLoadNextRightAd = function() {
        var t = this,
        e = this.singleCustomAdRightArr[this.rightSingleCustomAdIdIndex];
        this.rightSingleCustomAdIdIndex--,
        this.rightSingleCustomAdIdIndex < 0 && (this.rightSingleCustomAdIdIndex = this.singleCustomAdIDArray.length - 1);
        var o = this.singleCustomAdRightArr[this.rightSingleCustomAdIdIndex];
        if (o.ad) this.rightHallCustomAdTimer = setTimeout(function() {
            0 == e.isHide && e.isShow && e.ad.hide().then(function() {
                e.isHide = !0,
                e.isShow = !1,
                t.showRightHallCustomAd()
            })
        },
        this.refreshCustomAdTime);
        else {
            var i = this.systemInfo.windowWidth - 120,
            n = this.systemInfo.windowHeight / 2 - 70;
            o.ad = wx.createCustomAd({
                adUnitId: this.singleCustomAdIDArray[this.rightSingleCustomAdIdIndex],
                left: i,
                top: n,
                fixed: !1
            }),
            o.ad.onLoad(function() {
                o.isLoad = !0,
                t.rightHallCustomAdTimer = setTimeout(function() {
                    0 == e.isHide && e.isShow && e.ad.hide().then(function() {
                        e.isHide = !0,
                        e.isShow = !1,
                        t.showRightHallCustomAd()
                    })
                },
                t.refreshCustomAdTime)
            })
        }
    },
    t.prototype.showLeftGameCustomAd = function(t) {
        var e = this;
        clearTimeout(this.leftGameCustomAdTimer);
        var o = this.singleGameCustomAdLeftArr[this.leftSingleGameCustomAdIdIndex];
        o.isHide = !1,
        o.ad ? o.isLoad && o.ad.show().then(function() {
            o.isShow = !0,
            t && t(),
            e.preLoadNextLeftGameAd()
        }) : (o.ad = wx.createCustomAd({
            adUnitId: this.singleCustomAdIDArray[this.leftSingleGameCustomAdIdIndex],
            left: 20,
            top: 40,
            fixed: !1
        }), o.ad.onLoad(function() {
            o.isLoad = !0,
            !o.isHide && o.ad.show().then(function() {
                o.isShow = !0,
                t && t(),
                e.preLoadNextLeftGameAd()
            })
        }))
    },
    t.prototype.preLoadNextLeftGameAd = function() {
        var t = this,
        e = this.singleGameCustomAdLeftArr[this.leftSingleGameCustomAdIdIndex];
        this.leftSingleGameCustomAdIdIndex++,
        this.leftSingleGameCustomAdIdIndex > this.singleCustomAdIDArray.length - 1 && (this.leftSingleGameCustomAdIdIndex = 0);
        var o = this.singleGameCustomAdLeftArr[this.leftSingleGameCustomAdIdIndex];
        o.ad ? this.leftGameCustomAdTimer = setTimeout(function() {
            0 == e.isHide && e.isShow && e.ad.hide().then(function() {
                e.isHide = !0,
                e.isShow = !1,
                t.showLeftGameCustomAd()
            })
        },
        this.refreshCustomAdTime) : (o.ad = wx.createCustomAd({
            adUnitId: this.singleCustomAdIDArray[this.leftSingleGameCustomAdIdIndex],
            left: 20,
            top: 40,
            fixed: !1
        }), o.ad.onLoad(function() {
            o.isLoad = !0,
            t.leftGameCustomAdTimer = setTimeout(function() {
                0 == e.isHide && e.isShow && e.ad.hide().then(function() {
                    e.isHide = !0,
                    e.isShow = !1,
                    t.showLeftGameCustomAd()
                })
            },
            t.refreshCustomAdTime)
        }))
    },
    t.prototype.showRightGameCustomAd = function(t) {
        var e = this;
        clearTimeout(this.rightGameCustomAdTimer);
        var o = this.singleGameCustomAdRightArr[this.rightSingleGameCustomAdIdIndex];
        if (o.isHide = !1, o.ad) o.isLoad && o.ad.show().then(function() {
            o.isShow = !0,
            t && t(),
            e.preLoadNextRightGameAd()
        });
        else {
            var i = this.systemInfo.windowWidth - 90;
            o.ad = wx.createCustomAd({
                adUnitId: this.singleCustomAdIDArray[this.rightSingleGameCustomAdIdIndex],
                left: i,
                top: 40,
                fixed: !1
            }),
            o.ad.onLoad(function() {
                o.isLoad = !0,
                !o.isHide && o.ad.show().then(function() {
                    o.isShow = !0,
                    t && t(),
                    e.preLoadNextRightGameAd()
                })
            })
        }
    },
    t.prototype.preLoadNextRightGameAd = function() {
        var t = this,
        e = this.singleGameCustomAdRightArr[this.rightSingleGameCustomAdIdIndex];
        this.rightSingleGameCustomAdIdIndex--,
        this.rightSingleGameCustomAdIdIndex < 0 && (this.rightSingleGameCustomAdIdIndex = this.singleCustomAdIDArray.length - 1);
        var o = this.singleGameCustomAdRightArr[this.rightSingleGameCustomAdIdIndex];
        if (o.ad) this.rightGameCustomAdTimer = setTimeout(function() {
            0 == e.isHide && e.isShow && e.ad.hide().then(function() {
                e.isHide = !0,
                e.isShow = !1,
                t.showRightGameCustomAd()
            })
        },
        this.refreshCustomAdTime);
        else {
            var i = this.systemInfo.windowWidth - 90;
            o.ad = wx.createCustomAd({
                adUnitId: this.singleCustomAdIDArray[this.rightSingleGameCustomAdIdIndex],
                left: i,
                top: 40,
                fixed: !1
            }),
            o.ad.onLoad(function() {
                o.isLoad = !0,
                t.rightGameCustomAdTimer = setTimeout(function() {
                    0 == e.isHide && e.isShow && e.ad.hide().then(function() {
                        e.isHide = !0,
                        e.isShow = !1,
                        t.showRightGameCustomAd()
                    })
                },
                t.refreshCustomAdTime)
            })
        }
    },
    t.prototype.show_VerticalCustomAd = function(t, e, o, i) {
        var n = this;
        if (0 != this.isFitVersion("2.11.2")) {
            var a = this.nativeMultiGrid01Ad,
            r = this.nativeMultiGrid02Ad,
            s = t ? a: r,
            l = t ? this.systemInfo.windowWidth - 120 : 50,
            c = t ? this.systemInfo.windowWidth - 90 : 20,
            d = this.systemInfo.windowHeight / 2 - 170;
            t ? "game" == e ? (this.customAdRGame.isHide = !1, this.customAdRGame.ad || (this.customAdRGame.ad = wx.createCustomAd({
                adUnitId: s,
                left: c,
                top: 40,
                fixed: !1
            }), this.customAdRGame.ad.onLoad(function() {
                n.customAdRGame.isLoad = !0,
                n.customAdRGame.isHide || n.customAdRGame.ad.show().then(function() {
                    n.customAdRGame.isShow = !0,
                    cc.log("原生模板广告显示"),
                    o && o()
                })
            }), this.customAdRGame.ad.onClose(function() {
                cc.log("原生模板广告关闭"),
                i && i(),
                n.customAdRGame.ad = null,
                n.customAdRGame.isLoad = !1,
                n.customAdRGame.isShow = !1
            })), this.customAdRGame.isLoad && this.customAdRGame.ad.show().then(function() {
                n.customAdRGame.isShow = !0,
                cc.log("原生模板广告显示"),
                o && o()
            })) : (this.customAdR.isHide = !1, this.customAdR.ad || (this.customAdR.ad = wx.createCustomAd({
                adUnitId: s,
                left: l,
                top: d,
                fixed: !1
            }), this.customAdR.ad.onLoad(function() {
                n.customAdR.isLoad = !0,
                n.customAdR.isHide || n.customAdR.ad.show().then(function() {
                    n.customAdR.isShow = !0,
                    cc.log("原生模板广告显示"),
                    o && o()
                })
            }), this.customAdR.ad.onClose(function() {
                cc.log("原生模板广告关闭"),
                i && i(),
                n.customAdR.ad = null,
                n.customAdR.isLoad = !1,
                n.customAdR.isShow = !1
            })), this.customAdR.isLoad && this.customAdR.ad.show().then(function() {
                n.customAdR.isShow = !0,
                cc.log("原生模板广告显示"),
                o && o()
            })) : "game" == e ? (this.customAdLGame.isHide = !1, this.customAdLGame.ad || (this.customAdLGame.ad = wx.createCustomAd({
                adUnitId: s,
                left: l,
                top: 40,
                fixed: !1
            }), this.customAdLGame.ad.onLoad(function() {
                n.customAdLGame.isLoad = !0,
                n.customAdLGame.isHide || n.customAdLGame.ad.show().then(function() {
                    n.customAdLGame.isShow = !0,
                    cc.log("原生模板广告显示"),
                    o && o()
                })
            }), this.customAdLGame.ad.onClose(function() {
                cc.log("原生模板广告关闭"),
                i && i(),
                n.customAdLGame.ad = null,
                n.customAdLGame.isLoad = !1,
                n.customAdLGame.isShow = !1
            })), this.customAdLGame.isLoad && this.customAdLGame.ad.show().then(function() {
                n.customAdLGame.isShow = !0,
                cc.log("原生模板广告显示"),
                o && o()
            })) : (this.customAdL.isHide = !1, this.customAdL.ad || (this.customAdL.ad = wx.createCustomAd({
                adUnitId: s,
                left: l,
                top: d,
                fixed: !1
            }), this.customAdL.ad.onLoad(function() {
                n.customAdL.isLoad = !0,
                n.customAdL.isHide || n.customAdL.ad.show().then(function() {
                    n.customAdL.isShow = !0,
                    cc.log("原生模板广告显示"),
                    o && o()
                })
            }), this.customAdL.ad.onClose(function() {
                cc.log("原生模板广告关闭"),
                i && i(),
                n.customAdL.ad = null,
                n.customAdL.isLoad = !1,
                n.customAdL.isShow = !1
            })), this.customAdL.isLoad && this.customAdL.ad.show().then(function() {
                n.customAdL.isShow = !0,
                cc.log("原生模板广告显示"),
                o && o()
            }))
        }
    },
    t.prototype.hide_VerticalCustomAd = function(t, e) {
        var o = this;
        t ? "game" == e ? (this.customAdRGame.isHide = !0, this.customAdRGame.isShow && this.customAdRGame.ad.hide().then(function() {
            o.customAdRGame.isShow = !1
        })) : (this.customAdR.isHide = !0, this.customAdR.isShow && this.customAdR.ad.hide().then(function() {
            o.customAdR.isShow = !1
        })) : "game" == e ? (this.customAdLGame.isHide = !0, this.customAdLGame.isShow && this.customAdLGame.ad.hide().then(function() {
            o.customAdLGame.isShow = !1
        })) : (this.customAdL.isHide = !0, this.customAdL.isShow && this.customAdL.ad.hide().then(function() {
            o.customAdL.isShow = !1
        }))
    },
    t.prototype.init_horizontalAd = function() {
        var t = this;
        if (0 != this.isFitVersion("2.11.2") && !this.horizontalCustomAd.ad && 0 == this.horizontalCustomAd.is_show && null == this.horizontalCustomAd.ad && 0 == this.horizontalCustomAd.isLoad) {
            var e = function() {
                t.horizontalCustomAd.isLoad = !0,
                t.horizontalCustomAd.ad.offLoad(e)
            };
            this.horizontalCustomAd.ad = wx.createCustomAd({
                adUnitId: d.default.getIntance().WXAdUnit.nativeMultiGrid03Ad,
                adIntervals: 30,
                style: {
                    left: (wx.getSystemInfoSync().windowWidth - 288) / 2,
                    top: wx.getSystemInfoSync().windowHeight - 106 * .8,
                    fixed: !0
                }
            }),
            this.horizontalCustomAd.ad.onLoad(e)
        }
    },
    t.prototype.show_horizontalAd = function() {
        var t = this;
        if (0 != this.isFitVersion("2.11.2") && 0 == this.horizontalCustomAd.is_show) if (null == this.horizontalCustomAd.ad && 0 == this.horizontalCustomAd.isLoad) {
            var e = function() {
                t.horizontalCustomAd.isLoad = !0,
                t.horizontalCustomAd.ad.offLoad(e)
            };
            this.horizontalCustomAd.ad = wx.createCustomAd({
                adUnitId: "adunit-09b68e32009fc311",
                adIntervals: 30,
                style: {
                    left: (wx.getSystemInfoSync().windowWidth - 288) / 2,
                    top: (wx.getSystemInfoSync().windowHeight - 106 * .8) / 2 - 106 * .8 + 20,
                    fixed: !0
                }
            }),
            this.horizontalCustomAd.ad.onLoad(e)
        } else this.horizontalCustomAd.isLoad && this.horizontalCustomAd.ad.show().then(function() {
            t.horizontalCustomAd.is_show = !0
        }).
        catch(function() {
            t.horizontalCustomAd.is_show = !1,
            t.horizontalCustomAd.ad = null,
            t.horizontalCustomAd.isLoad = !1
        })
    },
    t.prototype.hide_horizontalAd = function() {
        var t = this;
        0 != this.isFitVersion("2.11.2") && this.horizontalCustomAd.ad && this.horizontalCustomAd.is_show && this.horizontalCustomAd.ad.hide().then(function() {
            t.horizontalCustomAd.is_show = !1
        }).
        catch(function() {
            t.horizontalCustomAd.is_show = !1,
            t.horizontalCustomAd.ad = null,
            t.horizontalCustomAd.isLoad = !1
        })
    },
    t.prototype.init_customAd_horizontal_full_screen = function() {
        var t = this;
        if (0 != this.isFitVersion("2.11.2") && !(this.customAdArray[0].ad || this.customAdArray[1].ad || this.customAdArray[2].ad)) for (var e = function(e) {
            if (0 == o.customAdArray[e].is_show && null == o.customAdArray[e].ad && 0 == o.customAdArray[e].isLoad) {
                var i = function() {
                    t.customAdArray[e].isLoad = !0,
                    t.customAdArray[e].ad.offLoad(i)
                };
                o.customAdArray[e].ad = wx.createCustomAd({
                    adUnitId: o.customAdIDArray[e],
                    adIntervals: 30,
                    style: {
                        left: (wx.getSystemInfoSync().windowWidth - 68) / 2 + (68 * e - 68),
                        top: (wx.getSystemInfoSync().windowHeight - 106) / 2,
                        fixed: !0
                    }
                }),
                o.customAdArray[e].ad.onLoad(i)
            }
        },
        o = this, i = 0; i < this.customAdArray.length; i++) e(i)
    },
    t.prototype.show_customAd_horizontal_full_screen = function() {
        var t = this;
        if (0 != this.isFitVersion("2.11.2")) for (var e = function(e) {
            if (0 == o.customAdArray[e].is_show) if (null == o.customAdArray[e].ad && 0 == o.customAdArray[e].isLoad) {
                var i = function() {
                    t.customAdArray[e].isLoad = !0,
                    t.customAdArray[e].ad.offLoad(i)
                };
                o.customAdArray[e].ad = wx.createCustomAd({
                    adUnitId: o.customAdIDArray[e],
                    adIntervals: 30,
                    style: {
                        left: (wx.getSystemInfoSync().windowWidth - 68) / 2 + (68 * e - 68),
                        top: (wx.getSystemInfoSync().windowHeight - 106 * .8) / 2 - 106 * .8 + 20,
                        fixed: !0
                    }
                }),
                o.customAdArray[e].ad.onLoad(i)
            } else o.customAdArray[e].isLoad && o.customAdArray[e].ad.show().then(function() {
                t.customAdArray[e].is_show = !0
            }).
            catch(function() {
                t.customAdArray[e].is_show = !1,
                t.customAdArray[e].ad = null,
                t.customAdArray[e].isLoad = !1
            })
        },
        o = this, i = 0; i < this.customAdArray.length; i++) e(i)
    },
    t.prototype.hide_customAd_horizontal_full_screen = function() {
        var t = this;
        if (0 != this.isFitVersion("2.11.2")) for (var e = function(e) {
            o.customAdArray[e].is_show && o.customAdArray[e].ad.hide().then(function() {
                t.customAdArray[e].is_show = !1
            }).
            catch(function() {
                t.customAdArray[e].is_show = !1,
                t.customAdArray[e].ad = null,
                t.customAdArray[e].isLoad = !1
            })
        },
        o = this, i = 0; i < this.customAdArray.length; i++) e(i)
    },
    t.prototype.showMatrixCustomAd = function(t) {
        var e = this;
        if (0 != this.isFitVersion("2.11.2")) {
            if (this.matrixCustomAd.isHide = !1, !this.matrixCustomAd.ad) {
                this.matrixCustomAd.ad = wx.createCustomAd({
                    adUnitId: d.default.getIntance().WXAdUnit.nativeMatrixGridAd,
                    left: wx.getSystemInfoSync().windowWidth / 2 - 200,
                    top: wx.getSystemInfoSync().windowHeight / 2 - 150,
                    width: 400,
                    fixed: !1
                }),
                this.matrixCustomAd.ad.onLoad(function() {
                    e.matrixCustomAd.isLoad = !0,
                    e.matrixCustomAd.isHide || e.matrixCustomAd.ad.show().then(function() {
                        e.matrixCustomAd.isShow = !0,
                        c.Util.hideBanner(),
                        c.Util.event_dispatcher.sendMessage("onMatrixAdShow")
                    })
                });
                var o = function(i) {
                    t && t.error && t.error.call(t.caller),
                    cc.log("matrixAd err: " + JSON.stringify(i)),
                    e.matrixCustomAd.ad = null,
                    e.matrixCustomAd.ad.offError(o)
                };
                this.matrixCustomAd.ad.onError(o),
                this.matrixCustomAd.ad.onClose(function() {
                    e.matrixCustomAd.ad = null,
                    e.matrixCustomAd.isLoad = !1,
                    e.matrixCustomAd.isShow = !1
                }),
                this.matrixCustomAd.ad.onHide(function() {
                    c.Util.event_dispatcher.sendMessage("onshowSingleCustomAd"),
                    c.Util.event_dispatcher.sendMessage("onMatrixAdClose"),
                    c.Util.event_dispatcher.sendMessage("closeMatrixAdCB")
                })
            }
            this.matrixCustomAd.isLoad && this.matrixCustomAd.ad.show().then(function() {
                e.matrixCustomAd.isShow = !0,
                c.Util.hideBanner(),
                cc.log("矩阵格子显示成功"),
                c.Util.event_dispatcher.sendMessage("onMatrixAdShow")
            })
        }
    },
    t.prototype.hideMatrixCustomAd = function() {
        var t = this;
        this.matrixCustomAd.isHide = !0,
        this.matrixCustomAd.isShow && this.matrixCustomAd.ad.hide().then(function() {
            t.matrixCustomAd.isShow = !1
        })
    },
    t.prototype.showMajiaCustomAd = function() {
        var t = this;
        if (!a.default.isTest && 0 != this.isFitVersion("2.11.2") && (this.majiaCustomAd.isHide = !1, !this.majiaCustomAd.ad)) {
            this.majiaCustomAd.ad = wx.createCustomAd({
                adUnitId: "adunit-6321bea5ff05ea3a",
                left: wx.getSystemInfoSync().windowWidth / 2 - 200,
                top: wx.getSystemInfoSync().windowHeight / 2 + 80,
                width: 400,
                fixed: !1
            }),
            this.majiaCustomAd.ad.onLoad(function() {
                t.majiaCustomAd.isLoad = !0,
                t.majiaCustomAd.isHide || t.majiaCustomAd.ad.show().then(function() {
                    t.majiaCustomAd.isShow = !0,
                    c.Util.hideBanner(),
                    c.Util.event_dispatcher.sendMessage("onMatrixAdShow")
                })
            });
            var e = function(o) {
                cc.log("matrixAd err: " + JSON.stringify(o)),
                t.majiaCustomAd.ad = null,
                t.majiaCustomAd.ad.offError(e)
            };
            this.majiaCustomAd.ad.onError(e)
        }
    },
    t.prototype.hideMajiaCustomAd = function() {
        var t = this;
        a.default.isTest || (this.majiaCustomAd.isHide = !0, this.majiaCustomAd.isShow && this.majiaCustomAd.ad.hide().then(function() {
            t.majiaCustomAd.isShow = !1
        }))
    },
    t.prototype.show_gridAd = function(t, e) {
        var o = this;
        this.gridAd && this.gridAd.destroy(),
        this.gridAd = wx.createGridAd({
            adUnitId: "adunit-dd545635e0286229",
            adIntervals: 30,
            adTheme: "white",
            gridCount: 8,
            style: {
                left: 0,
                top: 0,
                width: 100,
                height: 50
            }
        });
        var i = function() {
            o.gridAd.show().then(function() {
                t && t(),
                o.gameVersion == o.config_version && o.hide_banner()
            }).
            catch(),
            o.gridAd.offLoad(i)
        };
        this.gridAd.offLoad(i),
        this.gridAd.onLoad(i);
        var n = function(t) {
            cc.log("gridAd width: " + t.width + " height: " + t.height),
            o.gridAd.style.left = o.systemInfo.windowWidth / 2 - t.width / 2,
            e || (o.gridAd.style.top = o.systemInfo.windowHeight - t.height - 100),
            cc.log("gridAd top: " + o.gridAd.style.top),
            o.gridAd.offResize(n)
        };
        this.gridAd.offResize(n),
        this.gridAd.onResize(n);
        var a = function(t) {
            cc.log(t),
            o.gridAd.offError(a)
        };
        this.gridAd.offError(a),
        this.gridAd.onError(a)
    },
    t.prototype.hide_gridAd = function() {
        this.gridAd && this.gridAd.hide()
    },
    t.prototype.getBranchId = function(t, e) {
        if ("loading" == t) switch (e) {
            case "enter":
                return "BCBgAAoXHx5d0l0VVJKBmx";
            case "load10":
                return "BCBgAAoXHx5d0l0VVJKBmy";
            case "load50":
                return "BCBgAAoXHx5d0l0VVJKBmz";
            case "load80":
                return "BCBgAAoXHx5d0l0VVJKBm0";
            case "load100":
                return "BCBgAAoXHx5d0l0VVJKBm1";
            default:
                return null;
        } else if ("hall" == t) switch (e) {
            case "btnGameStart":
                return "BCBgAAoXHx5d0l0VVJKBm2";
            case "btnBox":
                return "BCBgAAoXHx5d0l0VVJKBm3";
            case "btnAssembly1":
                return "BCBgAAoXHx5d0l0VVJKBm4";
            case "btnAssembly2":
                return "BCBgAAoXHx5d0l0VVJKBm5";
            case "btnAssembly3":
                return "BCBgAAoXHx5d0l0VVJKBm6";
            default:
                return null;
        } else {
            if ("gamePK" == t) return null;
            if (t == s.SceneName.Ads) switch (e) {
                case s.BranchId.VideoAd:
                    return "BCBgAAoXHx5d0l0VVJKBm7";
                default:
                    return null;
            } else if ("HallDailyView" == t) switch (e) {
                case "getState":
                    return "BCBgAAoXHx5d0l0VVJKBm8";
                default:
                    return null;
            }
        }
    },
    t.prototype.reportUseBehavior = function(t, e, o, i) {
        var n = this.getBranchId(t, e);
        n && (i = i || "", cc.log("reportUseBehavior -- branchId = " + n + ", eventType = " + o + ", branchDim = " + i), wx.reportUserBehaviorBranchAnalytics({
            branchId: n,
            branchDim: i,
            eventType: o
        }))
    },
    t._instance = null,
    t
} ();
o.default = h